Skip to content

Conversation

@eddeee888
Copy link
Collaborator

@eddeee888 eddeee888 commented Jan 8, 2026

Description

any disables any typechecks and feedback from the TypeScript language server.
unknown forces the user to check at runtime, so it's better than any.

This PR:

  • changes the default scalar type to unknown for the reasons above.
  • Input and Variables fields may take undefined values if it is nullable

Related #10496

Type of change

  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

@changeset-bot
Copy link

changeset-bot bot commented Jan 8, 2026

🦋 Changeset detected

Latest commit: b87e885

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 11 packages
Name Type
@graphql-codegen/visitor-plugin-common Major
@graphql-codegen/typescript-operations Major
@graphql-codegen/typescript Major
@graphql-codegen/typescript-resolvers Major
@graphql-codegen/client-preset Major
@graphql-codegen/typescript-document-nodes Patch
@graphql-codegen/gql-tag-operations Patch
@graphql-codegen/typed-document-node Patch
@graphql-codegen/introspection Patch
@graphql-codegen/graphql-modules-preset Patch
@graphql-codegen/cli Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@github-actions
Copy link
Contributor

github-actions bot commented Jan 8, 2026

🚀 Snapshot Release (alpha)

The latest changes of this PR are available as alpha on npm (based on the declared changesets):

Package Version Info
@graphql-codegen/cli 6.1.1-alpha-20260113141826-b87e885fd6c88d2baffa14fd9f42f0f1b5a4dfcb npm ↗︎ unpkg ↗︎
@graphql-codegen/introspection 5.0.1-alpha-20260113141826-b87e885fd6c88d2baffa14fd9f42f0f1b5a4dfcb npm ↗︎ unpkg ↗︎
@graphql-codegen/visitor-plugin-common 7.0.0-alpha-20260113141826-b87e885fd6c88d2baffa14fd9f42f0f1b5a4dfcb npm ↗︎ unpkg ↗︎
@graphql-codegen/typescript-document-nodes 5.0.8-alpha-20260113141826-b87e885fd6c88d2baffa14fd9f42f0f1b5a4dfcb npm ↗︎ unpkg ↗︎
@graphql-codegen/gql-tag-operations 5.1.3-alpha-20260113141826-b87e885fd6c88d2baffa14fd9f42f0f1b5a4dfcb npm ↗︎ unpkg ↗︎
@graphql-codegen/typescript-operations 6.0.0-alpha-20260113141826-b87e885fd6c88d2baffa14fd9f42f0f1b5a4dfcb npm ↗︎ unpkg ↗︎
@graphql-codegen/typescript-resolvers 6.0.0-alpha-20260113141826-b87e885fd6c88d2baffa14fd9f42f0f1b5a4dfcb npm ↗︎ unpkg ↗︎
@graphql-codegen/typed-document-node 6.1.6-alpha-20260113141826-b87e885fd6c88d2baffa14fd9f42f0f1b5a4dfcb npm ↗︎ unpkg ↗︎
@graphql-codegen/typescript 6.0.0-alpha-20260113141826-b87e885fd6c88d2baffa14fd9f42f0f1b5a4dfcb npm ↗︎ unpkg ↗︎
@graphql-codegen/client-preset 6.0.0-alpha-20260113141826-b87e885fd6c88d2baffa14fd9f42f0f1b5a4dfcb npm ↗︎ unpkg ↗︎
@graphql-codegen/graphql-modules-preset 5.1.3-alpha-20260113141826-b87e885fd6c88d2baffa14fd9f42f0f1b5a4dfcb npm ↗︎ unpkg ↗︎

@eddeee888 eddeee888 force-pushed the master-next-default-scalar-type-is-unknown branch 2 times, most recently from 1f47eb4 to ffb3b8f Compare January 8, 2026 14:38
}

typePart = usedInputType.tsType; // If the schema is correct, when reversing typeNodes, the first node would be `NamedType`, which means we can safely set it as the base for typePart
if (usedInputType.tsType !== 'any' && !typeNode.isNonNullable) {
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When unknown and any is used, | null | undefined is not required.
However, the logic could be complex, so I'll bring back this condition and tests in another PR.

@eddeee888 eddeee888 marked this pull request as ready for review January 10, 2026 14:05
@eddeee888 eddeee888 force-pushed the master-next-default-scalar-type-is-unknown branch from 70dd961 to 033594f Compare January 13, 2026 14:03
@eddeee888 eddeee888 merged commit e8959d9 into master-next Jan 15, 2026
19 checks passed
@eddeee888 eddeee888 deleted the master-next-default-scalar-type-is-unknown branch January 15, 2026 11:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants